asSingleNode

public abstract Optional<Node> asSingleNode()

Returns an Optional that contains the XPath result represented as a single node or an empty Optional if it does not exist.

Throws

if the result is not of a single node type (see isSingleNode)

when the document this instance belongs to is closed